<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: csnf
  Date: 2024/12/30
  Time: 13:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>任务列表</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            background-color: #f4f4f9;
        }
        h1 {
            color: #333;
        }
        form {
            margin-bottom: 20px;
        }
        input[type="text"] {
            padding: 8px;
            margin-right: 10px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        input[type="submit"] {
            background-color: #28a745;
            color: white;
            padding: 8px 15px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        input[type="submit"]:hover {
            background-color: #218838;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
        th, td {
            border: 1px solid #ddd;
            padding: 12px;
            text-align: left;
        }
        th {
            background-color: #f2f2f2;
        }
        tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        tr:hover {
            background-color: #f1f1f1;
        }
        a {
            text-decoration: none;
            color: #007BFF;
            margin-right: 10px;
        }
        a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
<h1>任务列表</h1>
<form action="getTaskByName">
    <label for="taskName">任务名称：</label>
    <input type="text" id="taskName" name="taskName">
    <label for="taskGroup">任务分组：</label>
    <input type="text" id="taskGroup" name="taskGroup">
    <input type="submit" value="查询">
    <a href="addTask.jsp">添加任务</a>
</form>
<table>
    <tr>
        <th>任务名称</th>
        <th>任务分组</th>
        <th>任务内容</th>
        <th>任务表达式</th>
        <th>任务状态</th>
        <th>任务日期</th>
        <th>任务策略</th>
        <th>任务当前</th>
        <th>任务描述</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${tasks}" var="task">
        <tr>
            <td>${task.taskName}</td>
            <td>${task.taskGroup}</td>
            <td>${task.taskContent}</td>
            <td>${task.taskExpression}</td>
            <td>${task.taskState}</td>
            <td>${task.taskDate}</td>
            <td>${task.taskStrategy}</td>
            <td>${task.taskCurrent}</td>
            <td>${task.taskDesc}</td>
            <td>
                <a href="getTaskById?taskId=${task.taskId}">修改</a>
                <a href="javascript:void(0)" onclick="deleteTask(${task.taskId})">删除</a>
            </td>
        </tr>
    </c:forEach>
</table>
<script>
    function deleteTask(taskId) {
        if (confirm("确定删除吗？")) {
            location.href = "deleteTask?taskId=" + taskId;
        }
    }
</script>
</body>
</html>
